package com.jvmmonitor.model;

/**
 * GC统计数据模型
 */
public class GcStats {
    // GC类型枚举
    public enum GcType {
        YOUNG_GC,    // 年轻代GC
        OLD_GC,      // 老年代GC
        FULL_GC,     // 全堆GC
        UNKNOWN      // 未知类型
    }
    
    // GC类型
    private GcType gcType;
    
    // GC开始时间戳
    private long startTime;
    
    // GC持续时间（毫秒）
    private long duration;
    
    // 回收的堆内存大小（字节）
    private long heapMemoryBefore;
    private long heapMemoryAfter;
    private long heapMemoryRecycled;
    
    // 回收的年轻代内存大小（字节）
    private long youngMemoryBefore;
    private long youngMemoryAfter;
    private long youngMemoryRecycled;
    
    // 回收的老年代内存大小（字节）
    private long oldMemoryBefore;
    private long oldMemoryAfter;
    private long oldMemoryRecycled;
    
    // 回收的不同大小对象数量和内存
    private long smallObjectsRecycledCount;
    private long smallObjectsRecycledSize;
    
    private long mediumObjectsRecycledCount;
    private long mediumObjectsRecycledSize;
    
    private long largeObjectsRecycledCount;
    private long largeObjectsRecycledSize;
    
    // GC原因
    private String gcCause;
    
    // GC相关的内存池信息
    private String memoryPoolNames;
    
    // Getters and Setters
    public GcType getGcType() {
        return gcType;
    }
    
    public void setGcType(GcType gcType) {
        this.gcType = gcType;
    }
    
    public long getStartTime() {
        return startTime;
    }
    
    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }
    
    public long getDuration() {
        return duration;
    }
    
    public void setDuration(long duration) {
        this.duration = duration;
    }
    
    public long getHeapMemoryBefore() {
        return heapMemoryBefore;
    }
    
    public void setHeapMemoryBefore(long heapMemoryBefore) {
        this.heapMemoryBefore = heapMemoryBefore;
    }
    
    public long getHeapMemoryAfter() {
        return heapMemoryAfter;
    }
    
    public void setHeapMemoryAfter(long heapMemoryAfter) {
        this.heapMemoryAfter = heapMemoryAfter;
    }
    
    public long getHeapMemoryRecycled() {
        return heapMemoryRecycled;
    }
    
    public void setHeapMemoryRecycled(long heapMemoryRecycled) {
        this.heapMemoryRecycled = heapMemoryRecycled;
    }
    
    public long getYoungMemoryBefore() {
        return youngMemoryBefore;
    }
    
    public void setYoungMemoryBefore(long youngMemoryBefore) {
        this.youngMemoryBefore = youngMemoryBefore;
    }
    
    public long getYoungMemoryAfter() {
        return youngMemoryAfter;
    }
    
    public void setYoungMemoryAfter(long youngMemoryAfter) {
        this.youngMemoryAfter = youngMemoryAfter;
    }
    
    public long getYoungMemoryRecycled() {
        return youngMemoryRecycled;
    }
    
    public void setYoungMemoryRecycled(long youngMemoryRecycled) {
        this.youngMemoryRecycled = youngMemoryRecycled;
    }
    
    public long getOldMemoryBefore() {
        return oldMemoryBefore;
    }
    
    public void setOldMemoryBefore(long oldMemoryBefore) {
        this.oldMemoryBefore = oldMemoryBefore;
    }
    
    public long getOldMemoryAfter() {
        return oldMemoryAfter;
    }
    
    public void setOldMemoryAfter(long oldMemoryAfter) {
        this.oldMemoryAfter = oldMemoryAfter;
    }
    
    public long getOldMemoryRecycled() {
        return oldMemoryRecycled;
    }
    
    public void setOldMemoryRecycled(long oldMemoryRecycled) {
        this.oldMemoryRecycled = oldMemoryRecycled;
    }
    
    public long getSmallObjectsRecycledCount() {
        return smallObjectsRecycledCount;
    }
    
    public void setSmallObjectsRecycledCount(long smallObjectsRecycledCount) {
        this.smallObjectsRecycledCount = smallObjectsRecycledCount;
    }
    
    public long getSmallObjectsRecycledSize() {
        return smallObjectsRecycledSize;
    }
    
    public void setSmallObjectsRecycledSize(long smallObjectsRecycledSize) {
        this.smallObjectsRecycledSize = smallObjectsRecycledSize;
    }
    
    public long getMediumObjectsRecycledCount() {
        return mediumObjectsRecycledCount;
    }
    
    public void setMediumObjectsRecycledCount(long mediumObjectsRecycledCount) {
        this.mediumObjectsRecycledCount = mediumObjectsRecycledCount;
    }
    
    public long getMediumObjectsRecycledSize() {
        return mediumObjectsRecycledSize;
    }
    
    public void setMediumObjectsRecycledSize(long mediumObjectsRecycledSize) {
        this.mediumObjectsRecycledSize = mediumObjectsRecycledSize;
    }
    
    public long getLargeObjectsRecycledCount() {
        return largeObjectsRecycledCount;
    }
    
    public void setLargeObjectsRecycledCount(long largeObjectsRecycledCount) {
        this.largeObjectsRecycledCount = largeObjectsRecycledCount;
    }
    
    public long getLargeObjectsRecycledSize() {
        return largeObjectsRecycledSize;
    }
    
    public void setLargeObjectsRecycledSize(long largeObjectsRecycledSize) {
        this.largeObjectsRecycledSize = largeObjectsRecycledSize;
    }
    
    public String getGcCause() {
        return gcCause;
    }
    
    public void setGcCause(String gcCause) {
        this.gcCause = gcCause;
    }
    
    public String getMemoryPoolNames() {
        return memoryPoolNames;
    }
    
    public void setMemoryPoolNames(String memoryPoolNames) {
        this.memoryPoolNames = memoryPoolNames;
    }
    
    @Override
    public String toString() {
        return "GcStats{" +
                "gcType=" + gcType +
                ", startTime=" + startTime +
                ", duration=" + duration +
                ", heapMemoryRecycled=" + heapMemoryRecycled +
                ", youngMemoryRecycled=" + youngMemoryRecycled +
                ", oldMemoryRecycled=" + oldMemoryRecycled +
                ", smallObjectsRecycledCount=" + smallObjectsRecycledCount +
                ", smallObjectsRecycledSize=" + smallObjectsRecycledSize +
                ", mediumObjectsRecycledCount=" + mediumObjectsRecycledCount +
                ", mediumObjectsRecycledSize=" + mediumObjectsRecycledSize +
                ", largeObjectsRecycledCount=" + largeObjectsRecycledCount +
                ", largeObjectsRecycledSize=" + largeObjectsRecycledSize +
                ", gcCause='" + gcCause + '\'' +
                '}';
    }
}